package com.example.springcloud.feign.client;

import com.example.springcloud.feign.api.dto.UserDTO;
import com.example.springcloud.rpc.api.PageRequest;
import com.example.springcloud.rpc.api.PageResponse;
import com.example.springcloud.rpc.client.config.FeignConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;

/**
 * @author fanhang
 */
@SpringBootApplication
@EnableFeignClients(defaultConfiguration = FeignConfig.class)
public class ClientBoot implements CommandLineRunner {
    @Autowired
    private UserClient userClient;

    public static void main(String[] args) {
        SpringApplication.run(ClientBoot.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        PageRequest page = PageRequest.of(2, 10);
        PageResponse<UserDTO> result = userClient.getUserList(page);
        System.out.println(result);
    }

}
